[IA64] more cleanup in vhpt.h
authorawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Fri, 21 Apr 2006 15:06:38 +0000 (09:06 -0600)
committerawilliam@xenbuild.aw <awilliam@xenbuild.aw>
Fri, 21 Apr 2006 15:06:38 +0000 (09:06 -0600)
VHPT_CCHAIN_LOOKUP removed, body is now inlined in ivt.S
vhpt_insert() is now written in C.
Cleanup within vhpt.c/.h

Signed-off-by: Tristan Gingold <tristan.gingold@bull.net>
xen/arch/ia64/xen/ivt.S
xen/arch/ia64/xen/vhpt.c
xen/arch/ia64/xen/xenasm.S
xen/include/asm-ia64/vhpt.h

index 14396813ded21443692cecba29742a1fafcfe7f3..fb37125cf6743c196b7903e14300e738769f87d0 100644 (file)
@@ -249,9 +249,21 @@ END(vhpt_miss)
 ENTRY(itlb_miss)
        DBG_FAULT(1)
 #ifdef XEN
-       VHPT_CCHAIN_LOOKUP(itlb_miss,i)
+       mov r31 = pr
+       mov r16 = cr.ifa
+       ;;
+       extr.u r17=r16,59,5
+       ;;
+       /* If address belongs to VMM, go to alt tlb handler */
+       cmp.eq p6,p0=0x1e,r17
+(p6)   br.cond.spnt    late_alt_itlb_miss
+       ;;
+       cmp.eq p6,p0=0x1d,r17
+(p6)   br.cond.spnt    late_alt_itlb_miss
+       ;;
+       mov pr = r31, 0x1ffff
+       ;;                                                      
 #ifdef VHPT_GLOBAL
-//     br.cond.sptk page_fault
        br.cond.sptk fast_tlb_miss_reflect
        ;;
 #endif
@@ -301,14 +313,23 @@ END(itlb_miss)
 ENTRY(dtlb_miss)
        DBG_FAULT(2)
 #ifdef XEN
-       VHPT_CCHAIN_LOOKUP(dtlb_miss,d)
+       mov r31=pr
+       mov r16=cr.ifa                          // get virtual address
+       ;;
+       extr.u r17=r16,59,5
+       ;;
+       /* If address belongs to VMM, go to alt tlb handler */
+       cmp.eq p6,p0=0x1e,r17
+(p6)   br.cond.spnt    late_alt_dtlb_miss
+       ;;
+       cmp.eq p6,p0=0x1d,r17
+(p6)   br.cond.spnt    late_alt_dtlb_miss
+       ;;
 #if VHPT_ENABLED
        // XXX TODO optimization
-       mov r31=pr                              // save predicates
        mov r30=cr.ipsr
        mov r28=cr.iip                  
-       mov r16=cr.ifa                          // get virtual address
-       mov r17=cr.isr                          // save predicates
+       mov r17=cr.isr
        ;;
 
        extr.u r18 = r30, IA64_PSR_CPL0_BIT, 2  // extract psr.cpl
@@ -413,13 +434,6 @@ END(dtlb_miss)
 // 0x0c00 Entry 3 (size 64 bundles) Alt ITLB (19)
 ENTRY(alt_itlb_miss)
        DBG_FAULT(3)
-#ifdef XEN
-//#ifdef VHPT_GLOBAL
-//     VHPT_CCHAIN_LOOKUP(alt_itlb_miss,i)
-//     br.cond.sptk page_fault
-//     ;;
-//#endif
-#endif
 #ifdef XEN
        mov r31=pr
        mov r16=cr.ifa          // get address that caused the TLB miss
@@ -478,13 +492,6 @@ END(alt_itlb_miss)
 // 0x1000 Entry 4 (size 64 bundles) Alt DTLB (7,46)
 ENTRY(alt_dtlb_miss)
        DBG_FAULT(4)
-#ifdef XEN
-//#ifdef VHPT_GLOBAL
-//     VHPT_CCHAIN_LOOKUP(alt_dtlb_miss,d)
-//     br.cond.sptk page_fault
-//     ;;
-//#endif
-#endif
 #ifdef XEN
        mov r31=pr
        mov r16=cr.ifa          // get address that caused the TLB miss
index b1f47360e8a2dacb392367c1049a736d21cda136..7b3d3d722dac6a2eb787e2dc9e7e7c3e69ae7643 100644 (file)
@@ -15,6 +15,8 @@
 #include <asm/dma.h>
 #include <asm/vhpt.h>
 
+extern long running_on_sim;
+
 DEFINE_PER_CPU (unsigned long, vhpt_paddr);
 DEFINE_PER_CPU (unsigned long, vhpt_pend);
 
@@ -101,16 +103,26 @@ static void vhpt_map(unsigned long pte)
        ia64_srlz_i();
 }
 
+void vhpt_insert (unsigned long vadr, unsigned long pte, unsigned long logps)
+{
+       struct vhpt_lf_entry *vlfe = (struct vhpt_lf_entry *)ia64_thash(vadr);
+       unsigned long tag = ia64_ttag (vadr);
+
+       /* No need to first disable the entry, since VHPT is per LP
+          and VHPT is TR mapped.  */
+       vlfe->itir = logps;
+       vlfe->page_flags = pte | _PAGE_P;
+       vlfe->ti_tag = tag;
+}
+
 void vhpt_multiple_insert(unsigned long vaddr, unsigned long pte, unsigned long logps)
 {
        unsigned long mask = (1L << logps) - 1;
-       extern long running_on_sim;
        int i;
 
        if (logps-PAGE_SHIFT > 10 && !running_on_sim) {
                // if this happens, we may want to revisit this algorithm
-               printf("vhpt_multiple_insert:logps-PAGE_SHIFT>10,spinning..\n");
-               while(1);
+               panic("vhpt_multiple_insert:logps-PAGE_SHIFT>10,spinning..\n");
        }
        if (logps-PAGE_SHIFT > 2) {
                // FIXME: Should add counter here to see how often this
@@ -151,12 +163,9 @@ void vhpt_init(void)
         * from domain heap when each domain is created. Assume xen buddy
         * allocator can provide natural aligned page by order?
         */
-//     vhpt_imva = alloc_xenheap_pages(VHPT_SIZE_LOG2 - PAGE_SHIFT);
        page = alloc_domheap_pages(NULL, VHPT_SIZE_LOG2 - PAGE_SHIFT, 0);
-       if (!page) {
-               printf("vhpt_init: can't allocate VHPT!\n");
-               while(1);
-       }
+       if (!page)
+               panic("vhpt_init: can't allocate VHPT!\n");
        paddr = page_to_maddr(page);
        __get_cpu_var(vhpt_paddr) = paddr;
        __get_cpu_var(vhpt_pend) = paddr + vhpt_total_size - 1;
index f1bc95e59c04f9ca04773465166a392177b2a0d5..6fbd8f21213c343a4d42e5fb18648500e04e0fee 100644 (file)
@@ -182,7 +182,7 @@ GLOBAL_ENTRY(ia64_new_rr7)
        mov r21=loc6                    // saved vhpt physical address
        ;;
        or r23=r25,r21                  // construct PA | page properties
-       mov r24=VHPT_PAGE_SHIFT<<2
+       mov r24=VHPT_SIZE_LOG2<<2
        ;;
        ptr.d   r22,r24
        ;;
@@ -504,19 +504,6 @@ stacked:
        br.ret.sptk.few rp
 END(pal_emulator_static)
 
-GLOBAL_ENTRY(vhpt_insert)
-//     alloc loc0 = ar.pfs, 3, 1, 0, 0
-       mov r16=r32
-       mov r26=r33
-       mov r27=r34
-       ;;
-       VHPT_INSERT()
-//     VHPT_INSERT1()  ... add collision chains later
-//     mov ar.pfs = loc0
-       br.ret.sptk.few rp
-       ;;
-END(vhpt_insert)
-
 //  These instructions are copied in the domains.
 //  This is the virtual PAL, which simply does an hypercall.
 //  The size is 2 bunldes (32 Bytes).  It handles both static and stacked
index 1b7cfc94f6d5c87b244a041ec86324ec9a165633..9253a47701905c4d93b6c381ca11d9a3bbc9c3a6 100644 (file)
@@ -11,8 +11,6 @@
 /* Number of entries in the VHPT.  The size of an entry is 4*8B == 32B */
 #define        VHPT_NUM_ENTRIES                (1 << (VHPT_SIZE_LOG2 - 5))
 
-#define        VHPT_PAGE_SHIFT                 VHPT_SIZE_LOG2
-
 #ifdef CONFIG_SMP
 # define vhpt_flush_all()      smp_vhpt_flush_all()
 #else
@@ -46,8 +44,8 @@ extern void vhpt_flush_address_remote(int cpu, unsigned long vadr,
                                      unsigned long addr_range);
 extern void vhpt_multiple_insert(unsigned long vaddr, unsigned long pte,
                                 unsigned long logps);
-extern void vhpt_insert (unsigned long vadr, unsigned long ptr,
-                        unsigned logps);
+extern void vhpt_insert (unsigned long vadr, unsigned long pte,
+                        unsigned long logps);
 extern void vhpt_flush(void);
 extern void smp_vhpt_flush_all(void);
 
@@ -56,59 +54,4 @@ DECLARE_PER_CPU (unsigned long, vhpt_paddr);
 DECLARE_PER_CPU (unsigned long, vhpt_pend);
 
 #endif /* !__ASSEMBLY */
-
-#if !VHPT_ENABLED
-#define VHPT_CCHAIN_LOOKUP(Name, i_or_d)
-#else
-
-// VHPT_CCHAIN_LOOKUP is intended to run with psr.i+ic off
-#define VHPT_CCHAIN_LOOKUP(Name, i_or_d)                       \
-                                                               \
-CC_##Name:;                                                    \
-       mov r31 = pr;                                           \
-       mov r16 = cr.ifa;                                       \
-       ;;                                                      \
-       extr.u r17=r16,59,5                                     \
-       ;;                                                      \
-       /* If address belongs to VMM, go to alt tlb handler */  \
-       cmp.eq p6,p0=0x1e,r17;                                  \
-(p6)   br.cond.spnt    late_alt_##Name                         \
-       ;;                                                      \
-       cmp.eq p6,p0=0x1d,r17;                                  \
-(p6)   br.cond.spnt    late_alt_##Name                         \
-       ;;                                                      \
-       mov pr = r31, 0x1ffff;                                  \
-       ;;                                                      
-
-
-/* r16 = vadr, r26 = pte, r27 = logps */ 
-#define VHPT_INSERT()                                  \
-       {.mmi;                                          \
-               thash r17 = r16;                        \
-               or r26 = 1, r26;                        \
-               nop 0;                                  \
-               ;;                                      \
-       };                                              \
-       {.mii;                                          \
-               ttag r21 = r16;                         \
-               adds r18 = VLE_ITIR_OFFSET, r17;        \
-               adds r19 = VLE_PGFLAGS_OFFSET, r17;     \
-               ;;                                      \
-       };                                              \
-       {.mmi;                                          \
-                                                       \
-               st8[r18] = r27;                         \
-               adds r20 = VLE_TITAG_OFFSET, r17;       \
-               nop 0;                                  \
-               ;;                                      \
-       };                                              \
-       {.mmb;                                          \
-               st8[r19] = r26;                         \
-               st8[r20] = r21;                         \
-               nop 0;                                  \
-               ;;                                      \
-       }
-
-
-#endif /* VHPT_ENABLED */
 #endif